//
//  MovieModel.h
//  ResidentEvil
//
//  Created by Nguyen Tri Chung on 1/7/15.
//
//

#ifndef __ResidentEvil__MovieModel__
#define __ResidentEvil__MovieModel__

#include <stdio.h>

#include "../util/util.h"

USING_NS_CC;

struct TextureAnimation {
    float start;
    float end;
    string pattern;
    bool loop;
};

struct SubTitle {
    float start;
    float end;
    string text;
};

struct Tape {
    int tapeId;
    vector<TextureAnimation> texAnimations;
    vector<SubTitle> subTitles;
};

class MovieModel : public Ref {
private:
    vector<Tape> tapes;
    Tape* playingTape;
    bool playing;
    
    float elapsedTime;
    TextureAnimation* curTextureAnimation;
    SubTitle* curSubTitle;
public:
    MovieModel();
    ~MovieModel() override;
    
    void takeTapes();
    void pickTapes(int tapeId);
    void eject();
    void play();
    void update(float dt);
    TextureAnimation* findTextureAnimation(float time);
    SubTitle* findSubTitle(float time);
};

#endif /* defined(__ResidentEvil__MovieModel__) */
